<template>
  <div class="item-item">
    <div class="top">
      <!-- <div class="left">1</div> -->
      <img :src="item.avatar" alt="" />
      <div class="right">
        <div class="title">{{ item.stem }}</div>
        <div class="username">
          <span>{{ item.creatorName }}</span>
          <span>|</span>
          <span>{{ item.createdAt }}</span>
        </div>
      </div>
    </div>
    <div class="middle" ref="content">
      {{ item.content }}
    </div>
    <div class="bottom">
      <span>点赞 {{ item.likeCount }}</span>
      <span>|</span>
      <span>浏览 {{ item.views }}</span>
    </div>
  </div>
</template>

<script>
export default {
  mounted() {
    this.$refs.content.innerHTML = this.item.content;
  },
  props: {
    item: {
      type: Object,
      default: () => {},
    },
  },
};
</script>

<style lang="less" scoped>
.item {
  padding: 10px;
  margin: 10px;
  .top {
    display: flex;

    img {
      width: 50px;
      height: 50px;
      border-radius: 50%;
    }
    .username {
      font-size: 14px;
      color: #aaa;
    }
    .right {
      flex: 1;
    }
  }
  .big {
    font-size: 20px;
    font-weight: 800;
  }
}
// 超过两行显示省略号
.middle {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
</style>
